package com.sparrow.orm;

import com.sparrow.enums.DIALECT;

public class Dialect {

	private DIALECT dialect;

	private static Dialect dialectInstance;

	public static Dialect getInstance(String dialect) {
		dialectInstance = new Dialect(DIALECT.valueOf(dialect.toUpperCase()));
		return dialectInstance;
	}

	private Dialect(DIALECT dialect) {
		this.dialect = dialect;
	}

	public String getOpenQuote() {
		switch (this.dialect) {
		case MYSQL:
			return "`";
		case SQL_SERVER:
			return "[";
		default:
			break;
		}
		return null;
	}

	public String getCloseQuote() {
		switch (this.dialect) {
		case MYSQL:
			return "`";
		case SQL_SERVER:
			return "]";
		default:
			break;
		}
		return null;
	}
}
